import { FC } from 'react';
import commonStyles from './common.module.scss'
import { radioPropsType } from '@/types/props';
import classNames from 'classnames';





const QuestionRadio:FC<radioPropsType> = ({fe_id,props}) => {
  const { options,title,value,isVertical } = props;
  const ulStyle = classNames({
    [commonStyles.verticalItem]:isVertical,
    [commonStyles.horizontalItem]:!isVertical
  })



  return <div className={commonStyles.container}>
    <div className={commonStyles.title}>{title}</div>
    <div className={commonStyles.list}>
      <ul className={commonStyles.radioList}>
        {options?.map((option,index) => (
          <li className={ulStyle} key={index}>
            <input type="radio" name={fe_id} value={option.label} defaultChecked={value === option.value}  />
            <label>{option.label}</label>
          </li>
        ))}
      </ul>
    </div>
  </div>
}


export default QuestionRadio;